
#include "serialio.h"
#include "olcd.h"

int OmnimaLCDAPI_Demo(char **ppport, char **ppbaud, unsigned char bDetectPort)
{
    termioType io;
    unsigned int i;
    
    if (bDetectPort && !DetectOLCDComPort(ppport, ppbaud)) return 0;
    
    if (!OOpenSerialPort(&io,  *ppport, *ppbaud)) return 0;
    
	if (!OmnimaAPIWaitForPrompt(&io, 1))
	{
		DebugPrintf(1, "LCD is not responding\n");
	}
	
    if (!OmnimaAPISendFileToSSD(&io, "testfiles/yamaha.ssd", 108544, 0))
    {
        DebugPrintf(1, "Failed to upload test ssd file\n");
    }
    
    OmnimaAPIBitBlt(&io, WIN_MAINPANEL, 50, 50, 100, 100, 
                         WIN_MAINPANEL, 120, 120, 100, 100);
                         
    Sleep(2000);
    
    //Scroll the picture to the left and out of the screen
    for(i=0;i<32;i++)
    {
        OmnimaAPIBitBlt(&io, WIN_MAINPANEL, 10, 0, 320, 240, 
                            WIN_MAINPANEL, 0, 0, 320, 240);
    }
        
    OCloseSerialPort(&io);
    return 0;
}